<?php

class ConfigurationComponent extends Component{
	
	var $config;
	var $components = array('Auth');
	
	public function initialize(){
		$this->config = ClassRegistry::init('Configuration');
	}
	
	public function sendEmail(){
		$dados = $this->config->findByKey('send_email');
		if($dados['Configuration']['value'] === 'true')
			return true;
		else return false;
	}
	
	public function receiveEmail($email){
		// TODO Arrumar aqui
		$this->User = ClassRegistry::init('User');
		$this->User->recursive = -1;
		$user = $this->User->findByEmail($email);
		if($user['User']['receber_email'] == 1)
			return true;
		else
			return false;
	}
	
}